<?php

$username = isset($_POST['username']) ? $_POST['username'] : "";
$password = isset($_POST['password']) ? $_POST['password'] : "";
$remember = isset($_POST['remember']) ? $_POST['remember'] : "";
if (!empty($username) && !empty($password)) { //建立连接
    $conn = mysqli_connect(localhost, root, 74642486,db_user,3306);
    $sql_select = "SELECT username,password FROM super_tb_user WHERE username = '$username' AND password = '$password'"; //执行SQL语句
    $ret = mysqli_query($conn, $sql_select);
    $row = mysqli_fetch_array($ret);
    if ($username == $row['username'] && $password == $row['password'])
    {
        if ($remember == "on")
        {
            setcookie("", $username, time() + 7 * 24 * 3600);
        }
        header("Location:super_loginsucc.php");
        mysqli_close($conn);
    }
    else
    {

        header("Location:superlogin.php?err=1");
    }
} else {
    header("Location:superlogin.php?err=2");
} ?>
